<template>
  <div>
    <h2>{{this.$parent.testname}}</h2>
    <h3>{{msg}}</h3>
    <button @click="getParentMethods">获取parent方法</button>
  </div>
</template>

<script>
export default {
  name: "son",
  data() {
    return {
        msg:''
    };
  },
  methods: {
    getParentMethods() {
      this.msg = this.$parent.testMethods();
    },
  },
};
</script>